Compressors and decompressors call progress functions to report on their progress in the current operation. When a component calls your progress function, it supplies you with a number that indicates the completion percentage. This fixed-point value may range from 0.0 through 1.0. Your program can cause the component to terminate the current operation by returning a result code of codecAbortErr .
The Image Compression Manager calls your progress function only during long operations, and it does not call your function more than 30 times per second.
The ProgressProcPtr data type defines a pointer to a progress function. You assign a progress function to an image or a sequence by passing a pointer to a structure that identifies the progress function to the appropriate function.
/* progress function structure */
typedef struct ICMProgressProcRecord ICMProgressProcRecord;
typedef ICMProgressProcRecord *ICMProgressProcRecordPtr;
The progress function structure contains the following fields:
struct ICMProgressProcRecord
{
ICMProgressUPP progressProc; /* ptr to progress function */
long progressRefCon;/* reference constant */
};
Your progress function should have the following form:
pascal OSErr MyProgressProc (short message, Fixed completeness,
long refcon);
The following functions have parameters that allow you to provide application-defined progress functions: FCompressImage , FDecompressImage , TrimImage , FCompressPicture , FCompressPictureFile , DrawPictureFile , DrawTrimmedPicture , DrawTrimmedPictureFile , MakeThumbNailFromPicture , MakeThumbnailFromPictureFile , MakeThumbnailFromPixMap , SetCompressedPixMapInfo , and GetCompressedPixMapInfo . If you pass a value of -1 in the progressProc parameter of any of these functions, you obtain a standard progress function.